<!DOCTYPE html>
<html>
<head>
    <meta content="text/html; charset=UTF-8" http-equiv="content-type">
    <title></title>
</head>
<body>
<script type="text/javascript">
    function Dom(seletor) {
        this.selector = seletor;
        this.elem = null;
        this.elem = this.getId(seletor);
    }
    Dom.prototype = {
        getId:function(id) {

        },
        setStyle:function(style) {
            var cssText='';
            for (var key in style) {
            //    this.elem.style[key] = style[key] + 'px';
                style[key]=typeof style[key]=='number'?style[key]+'px':style[key];
                cssText+=key+':'+style[key]+';';
            }
            this.elem.style.cssText=cssText;


        },
        
        getStyle:function(style) {
            if (window.getComputedStyle) {
                return  window.getComputedStyle(this.elem, null)[style];
            } else {
                var rect = this.elem.getBoundingClientRect();
                if (style === 'width') {
                    return rect.right - rect.left + 'px';
                } else if (style === 'height') {
                    return rect.bottom - rect.top + 'px';
                }
                return this.elem.currentStyle[key];
            }
        }
    } 
</script>
</body>
</html>